using System;
using WindowsPhoneMVC.Navigation;
using WindowsPhoneMVC.Navigation.Interfaces;

namespace WindowsPhoneMVC.ActionResults
{
    public class BackToResult : ActionResult, IHaveNavigationCompletedSteps
    {
        private readonly string controllerName;
        private readonly string actionName;

        public BackToResult(NavigationContext context, string controllerName, string actionName)
            : base(context)
        {
            this.controllerName = controllerName;
            this.actionName = actionName;
        }

        protected override void ExecuteInternal()
        {
        }

        public void NavigationComplete()
        {
            Context.Navigator.NavigateBackTo(controllerName, actionName);
        }
    }
}